package com.foreveross.proxyip.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.foreveross.proxyip.infra.base.ddd.domain.BaseEntity;
import com.foreveross.proxyip.infra.cache.IBufferCacheEntity;
import com.foreveross.proxyip.infra.db.mongo.annotation.MongoColumn;
import com.foreveross.proxyip.infra.db.mongo.annotation.MongoTable;

@javax.persistence.Entity
@Table(name="pi_ip_store")
@MongoTable("pi_ip_store")
public class IpStoreEntity extends BaseEntity implements IBufferCacheEntity {
	private static final long serialVersionUID = 1L;

	
	@GeneratedValue(generator="idGenerator") //使用uuid的生成策略
	@GenericGenerator(name="idGenerator", strategy="uuid") //这个是hibernate的注解
	@Id
	private String id;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="create_time")
	@MongoColumn("create_time")
	private Date createTime;

	@MongoColumn
	private String area;

	@MongoColumn
	private String ip;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="last_time")
	@MongoColumn("last_time")
	private Date lastTime;

	@MongoColumn
	private Integer port;

	@Column(name="response_time")
	@MongoColumn("response_time")
	private Integer responseTime;
	
	//状态//0 not use ,1 is useing(使用等级一般) 3 is delete, 4为比较优秀等级（延时性）,5为最优IP
	@MongoColumn
	private Integer state;
	
	@MongoColumn
	private String source ;

	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public IpStoreEntity() {
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date addTime) {
		this.createTime = addTime;
	}

	public String getArea() {
		return this.area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getIp() {
		return this.ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public Date getLastTime() {
		return this.lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public Integer getPort() {
		return this.port;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

	public Integer getResponseTime() {
		return this.responseTime;
	}

	public void setResponseTime(Integer responseTime) {
		this.responseTime = responseTime;
	}

	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

}